#!/bin/bash

# Compile and run C++ test
g++ -O0 ./fib.cpp -o ./fib
echo "Running C++ test..."
./fib
echo ""

# Run Python test
echo "Running Python test..."
python3 ./fib.py
echo ""

# Run JavaScript test
echo "Running JavaScript test..."
node ./fib.js
echo ""

# Run TypeScript test
echo "Running TypeScript test..."
if command -v tsx &> /dev/null; then
    tsx ./fib.ts
elif command -v ts-node &> /dev/null; then
    ts-node ./fib.ts
elif command -v deno &> /dev/null; then
    deno run ./fib.ts
else
    echo "TypeScript runtime not found. Please install tsx, ts-node, or deno."
fi
echo ""

# Run Vim9 script test
echo "Running Vim9 script test..."
vim -c "source ./fib9.vim" -c "echo 'Press Enter to exit...'" -c "call getchar()" -c "qa!"
echo ""

# Run Vim script test
echo "Running Vim script test..."
vim -c "source ./fib.vim" -c "echo 'Press Enter to exit...'" -c "call getchar()" -c "qa!"
echo ""

echo "All tests completed."